<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" 
	 xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
	 
	 
<head>
<meta content="text/html;charset=UTF-8"/>
<title sec:authentication="name"></title>
<link rel="stylesheet" th:href="@{css/bootstrap.min.css}" />
<style type="text/css">
body {
  padding-top: 50px;
}
.starter-template {
  padding: 40px 15px;
  text-align: center;
}
</style>
</head>
<body>
	 <nav class="navbar navbar-inverse navbar-fixed-top">
      <div  class="container">
        <div class="navbar-header">
          <a class="navbar-brand" href="#">Spring Security演示</a>
        </div>
        <div id="navbar" class="collapse navbar-collapse">
          <ul class="nav navbar-nav">
           <li><a th:href="@{/}"> 首页 </a></li>
              <li><a sec:authorize="hasRole('ROLE_ADMIN')" th:href="@{/admin}"> admin </a></li>
          </ul>
        </div>
      </div>
    </nav>
    
    
    
    
    <a th:href="@{/others}">点击进入hello-----非用户</a>
     <a th:href="@{/users}">点击进入hello------用户</a>
     <div class="container">

      <div     class="starter-template">
      	<h1 th:text="${msg.title}"></h1>
		
		<p sec:authorize="isAuthenticated()">
			<span sec:authentication="name"></span>，您好,您的角色有：
			<span sec:authentication="principal.authorities"></span>
		</p>
		
		<p class="bg-primary" th:text="${msg.content}"></p>
		
		<div sec:authorize="hasRole('ROLE_ADMIN')"> 
		 	<p class="bg-info" th:text="${msg.etraInfo}"></p>
		</div>
          <div sec:authorize="hasRole('ROLE_USER')">
              <p class="bg-info">恭喜您,您有 用户 角色 </p>
          </div>
		<div sec:authorize="hasRole('ROLE_NOUSER')"> 
              <p class="bg-info">恭喜您,您有 非用户 角色 </p>
          </div>
          <form th:action="@{/logout}" method="post">
            <input type="submit" class="btn btn-primary" value="注销"/>
        </form>
      </div>

    </div>
    
	
</body>
</html>
